package daily.play2;

import java.util.ArrayList;

//class Person{}
//class Student extends Person{}
//class male extends Student{
//}

//public class MyGenerics {
//    public static void main(String[] args) {
//        ArrayList<Person> list1 = new ArrayList<>();
//        ArrayList<Student> list2 = new ArrayList<>();
//        ArrayList<male> list3 = new ArrayList<>();
//        test(list1);
//        test(list2);
//        test(list3);
//    }
//    public static  void test(ArrayList<Person> list){}
//}

/*public class MyGenerics {
    public static void main(String[] args) {
        //泛型通配符
        ArrayList<Person> list1 = new ArrayList<>();
        ArrayList<Student> list2 = new ArrayList<>();
        ArrayList<male> list3 = new ArrayList<>();
        test(list1);
        test(list2);
        test(list3);
    }
    public static <E> void test(ArrayList<? extends Person> list){

    }
}*/
//public class MyGenerics {
//    public static void main(String[] args) {
//        //泛型通配符
//        ArrayList<Person> list1 = new ArrayList<>();
//        ArrayList<Student> list2 = new ArrayList<>();
//        ArrayList<male> list3 = new ArrayList<>();
//        test(list1);
//        test(list2);
//        test(list3);
//    }
//    public static <E> void test(ArrayList<? super male> list){
//
//    }
//}

public class MyGenerics {
    public static void main(String[] args){
        ArrayList<HsqDog> list1 = new ArrayList<>();
        keepPetDog(list1);
    }
    public static void keepPetCat(ArrayList<? extends Cat> list){
        System.out.println("可以养所有品种的猫");
    }
    public static void keepPetDog(ArrayList<? extends Dog> list){

    }
    public static void keepPetAnimal(ArrayList<? extends Animal> list){

    }
}
